export default {
	id: 'setting',
	state: () => {
		return {
			isCollapse: false,
			activeIndex: -1,
		};
	},
	getters: {
		getCollapse: (state) => state.isCollapse,
	},
	actions: {
		setCollapse() {
			this.isCollapse = !this.isCollapse;
		},
		setActive(index) {
			this.activeIndex = index;
		},
	},
	// 开启数据缓存
	persist: {
		enabled: true,
		strategies: [
			{
				key: 'settingInfo',
				storage: localStorage,
				// 存储 state 中的属性信息
				paths: ['activeIndex'],
			},
		],
	},
};
